---
title: clsTaskBusinessRules
summary: API reference for clsTaskBusinessRules.
status: draft
owner: SAIF Documentation
last_reviewed: 2026-08-21
library: SAIF.Business.Tasks
reference_type: embedded
---

# clsTaskBusinessRules

`clsTaskBusinessRules` implements the shared task validation rules invoked by the BOF rules engine during save. It is the one component in this library that reaches directly into the data layer (`ValidSourceCategory`) rather than delegating to a code-table business object — a coupling flagged in source as a `MUSTDO`.

## Purpose
- Validate that a task's source system / category code combination is registered in `TASK_CATEGORY_CODE` ([BR-005](../../business-rules.md#br-005-the-task-source-code-task-category-code-combination-must-exist), [SQL-005](../../sql/SQL-005-valid-source-category-check.md)).
- Enforce that a task's date is current or future, except for batch-created tasks ([BR-006](../../business-rules.md#br-006-a-task-must-carry-a-current-or-future-date), [BR-007](../../business-rules.md#br-007-batch-created-tasks-bypass-the-currentfuture-date-rule)).
- Surface a non-blocking warning when `AssignTaskDate` has auto-shifted a due date ([BR-008](../../business-rules.md#br-008-automatic-due-date-shifting-must-be-surfaced-as-a-warning)).

## Context
- Namespace: `SAIF.Business.Tasks`
- Assembly/package: `SAIF.Business.Tasks` (embedded in the `LegalMaintenance` web deployment)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `ValidSourceCategory` | `Shared Function ValidSourceCategory(target As Object, e As clsRuleArgs) As Boolean` | Runs a scalar `COUNT(*)` against `TASK_CATEGORY_CODE` to confirm the source/category pairing is valid ([BR-005](../../business-rules.md#br-005-the-task-source-code-task-category-code-combination-must-exist), [SQL-005](../../sql/SQL-005-valid-source-category-check.md)); a zero count fails at `RuleCheckLevel.LevelThree` unless the descendant's `OverrideRules` converts the result. |
| `CheckDate` | `Shared Function CheckDate(target As Object, e As clsRuleArgs) As Boolean` | Validates the task date is current or future, skipping the check for batch-created tasks ([BR-006](../../business-rules.md#br-006-a-task-must-carry-a-current-or-future-date), [BR-007](../../business-rules.md#br-007-batch-created-tasks-bypass-the-currentfuture-date-rule)). |
| `CheckDateModified` | `Shared Function CheckDateModified(target As Object, e As clsRuleArgs) As Boolean` | Raises a non-blocking `RuleType.Warning` message when the task date was auto-shifted by `AssignTaskDate` ([BR-008](../../business-rules.md#br-008-automatic-due-date-shifting-must-be-surfaced-as-a-warning)). |

## Behavioral notes
- All three rule functions are decorated with `<RuleData(...)>`, the BOF rules-engine registration attribute.
- `ValidSourceCategory` issues its own ad-hoc query directly against the target task's DPI rather than delegating to `clsTaskCategoryCode`/`clsTaskCategoryCodeCollection` — flagged in source as a `MUSTDO` to replace with a code-table call*.

## Constraints and usage notes
- All three functions match the BOF rule delegate signature `(target As Object, e As clsRuleArgs) As Boolean` and are registered via `clsTask.AddBusinessRules`.

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Related documentation
- [API index](../index.md)
- [Business rules](../../business-rules.md)
- [clsTask](clsTask.md)

## Sources
- SAIF.Business.Tasks/clsTaskBusinessRules.vb
